
<?php
		echo	"<div>";
		echo		"<img src='myinventory/inventorypic.png' style='padding:3px;'>"; 
		echo		"<textarea  id='textArea-type$iProductType' rows='3' cols='35'></textarea><br/>";
		echo		"<a href='javascript:PostComment($iProfile,$iProductType)' style='clear:both;'>Post</a>";
		echo	"</div>";
		//select value      
        $command = "select  iInventory ,sText from tInventory WHERE iProfile= $iProfile AND iProductType=$iProductType ORDER BY dLoadDate ASC;";
		//query
			$con = mysqli_connect("earth.cs.utep.edu",
									"wb_cjvicario",
									"utep987");

	$con->select_db("5339team1");
		$result = $con->query($command);

		$postsText=array();
		$inventoryNbrs=array();
		//get all posts
        while ($row = $result->fetch_array(MYSQLI_ASSOC))
        {
			array_push($postsText,$row['sText']);
			array_push($inventoryNbrs,$row['iInventory']);
        }
		
		$postsCount=count($postsText);
		
		for ($i=$postsCount-1; $i>=0; $i--)
		{	
			echo	"<div>";
			echo		"<img src='myinventory/inventorypic.png' style='padding:3px;'>";
			echo		"<textarea id='txtArea-".$inventoryNbrs[$i]."' rows='3' cols='35' disabled>";
			echo		$postsText[$i];
			echo		"</textarea>";
			echo		"<a href='javascript:EditPost($iProfile,$iProductType,$inventoryNbrs[$i])'>";
			echo			"<img id='img-". $inventoryNbrs[$i] ."' src='myinventory/PostEdit.png' alt='edit' height='20'>";
			echo 		"</a>";
			echo		"<input type='hidden' name='input-".$inventoryNbrs[$i]."' value='edit'>";
			echo		"<br/>";
			echo	"</div>";
		}
		/* echo	"<div>";
			echo		"<img src='inventorypic.png' style='padding:3px;'>";
			echo		"<textarea rows='3' cols='35' disabled>";
			echo		$row['sText'];
			echo		"</textarea><br/>";
			echo	"</div>";
		*/

        $con->close();
?>	